﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MediaScraper.DataAccess.Entities;

namespace MediaScraper.Dashboard.Models
{
    public class ActivityModel
    {
        public List<HistoryLogEntry> Entries { get; set; }

        public ActivityModel()
        {
            Entries = new List<HistoryLogEntry>();
        }

        public void AddEntry(ProcessHistoryEntry historyEntry)
        {
            Entries.Add(new HistoryLogEntry(historyEntry));
        }
    }



    public class HistoryLogEntry
    {
         public string OldPath { get; set; }
        public string OldFileName { get; set; }
        public string NewPath { get; set; }
        public string NewFilename { get; set; }
        public List<string> SubTitlesDownloaded { get; set; }
        public string Message { get; set; }
        public string ProcessDate { get; set; }
        public string ProcessClassification { get; set; }

        public HistoryLogEntry()
        {
            SubTitlesDownloaded = new List<string>();
        }

        public HistoryLogEntry(ProcessHistoryEntry historyEntry)
        {
            OldPath = historyEntry.OldPath;
            OldFileName = historyEntry.OldFileName;
            NewPath = historyEntry.NewPath;
            NewFilename = historyEntry.NewFilename;
            SubTitlesDownloaded = historyEntry.SubTitlesDownloaded;
            Message = historyEntry.Message;
            ProcessDate = historyEntry.ProcessDate.ToShortDateString();
            ProcessClassification = Enum.GetName(typeof (ProcessClassification), historyEntry.ProcessClassification);
        }
    }
}